which attribute is displayed in which column

Hello,

I want to check some modules attributes and columns, therefore i need to know which attribute is displayed in which column. I've written this:

Folder f = folder "/foo/bar"
 
Item i
 
AttrDef ad
 
int offset
int lenght1
bool matchCase = true
 
for i in f do
{
    if(type(i) == "Formal")
        {
                Module m = read(fullName(i), false)
 
                print fullName(m) "\n"
 
                for ad in m do
                {
                        if (findPlainText(ad.name, "HB_Project_Variant", offset, length1, matchCase) == true)
                        {
                                //missing part..
                        }
                
                }// end for AttrDef in Module
 
        }// end if itemType == formal
 
}// end for item in folder

 


Whats missing is the information in which colum the AttrDef found by the findPlainText function is displayed.
Is there any faster way to do this than with this loop?

 

 

 

for c in m do {
    if ((attrName c) == ad.name) {
        print ad.name "\t" title(c) "\n"
    }
}

 


Regards,
Manuel

 

 

 

 

 

 


ManuelFelger - Fri Dec 18 08:34:04 EST 2009

Re: which attribute is displayed in which column
Mathias Mamsch - Sun Dec 20 07:42:10 EST 2009

If you only want to know, what columns (in the standard view of a module) contain an attribute you can leave out the "for ad in module" loop altogether. You could just do something like this:
 

for i in f do
{
        // dont forget deleted items
    if(type(i) != "Formal" || isDeleted i) continue   
        // i think you need the module visible to iterate the colums
        Module m = read(fullname i, true)  
        print fullName(m) "\n"
        for c in m do {
                if ( findPlainText(attrName c, "HB_Project_Variant", offset, length1, matchCase) ) 
                        print ad.name "\t" title(c) "\n"
        }
    
}

 


The other thing you could do is put the column attributes to a skip list after opening the module and use a "find()" to check if the attribute is there instead of the slower "for col in module do if (attrName col == ...)"

Regards, Mathias